<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>点击按钮，显示或隐藏元素</title>
</head>
<body>
    <script src="../vue@2.6.14.min.js"></script>
    <div id="app">
        <h3 v-show="isShow">
            我是文本内容，我{{msg}}了
        </h3>
        <br>
        <button @click="switchShow">点击切换</button>
    </div>
    <script>
        new Vue({
            el: "#app",
            data() {
                return {
                    isShow: true,
                    msg: '显示'
                }
            },
            methods: {
                switchShow() {
                    this.isShow = !this.isShow;
                    this.msg = this.isShow ? '显示' : '隐藏';
                }
            }
        })
    </script>
</body>
</html>